//
//  UIView+DrawbackgroundImage.m
//  CJMobile
//
//  Created by 徐飞 on 15/11/13.
//  Copyright © 2015年 长江证券. All rights reserved.
//

#import "UIView+DrawbackgroundImage.h"

@implementation UITableView (DrawbackgroundImage)
//根据颜色来绘制背景图片
- (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size
{
    CGRect rect = CGRectMake(0, 0, size.width, size.height);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return image;
}

@end
